import Home from '@/views/home'
import Category from '@/views/category'
import SubCategory from '@/views/category/subcategory'
import Details from '@/views/details'
import Mine from '@/views/mine'
import Cart from '@/views/cart'
import NavBar from '@/components/navbar'
import TagBar from '@/components/tagbar'
import Login from '@/views/login'

const routes = [
  {
    path: '/',
    redirect: '/home' // redirect 重定向
  },
  {
    path: '/home',
    name: 'home',
    components: {
      header: NavBar,
      default: Home,
      footer: TagBar
    },
    meta: {
      title: '首页',
      icon: '&#xe734;',
      isTag: 'true'
    }
  },
  {
    path: '/category',
    name: 'cate',
    components: {
      header: NavBar,
      default: Category,
      footer: TagBar
    },
    meta: {
      title: '分类',
      icon: '&#xe7f9;',
      isTag: 'true'
    },
    children: [
      {
        path: 'sub/:cid',
        name: 'sub',
        component: SubCategory,
        meta: {
          title: '分类'
        }
      }
    ]
  },
  {
    path: '/details/:id',
    name: 'details',
    components: {
      default: Details

    },
    meta: {
      title: '详情'
    }
  },
  {
    path: '/cart',
    components: {
      header: NavBar,
      default: Cart,
      footer: TagBar
    },
    meta: {
      title: '购物车',
      icon: '&#xe600;',
      isTag: 'true'
    }
  },
  {
    path: '/mine',
    components: {
      header: NavBar,
      default: Mine,
      footer: TagBar
    },
    meta: {
      title: '我的',
      icon: '&#xe61d;',
      isTag: 'true'
    }
  },
  {
    path: '/login',
    components: {
      header: NavBar,
      default: Login
    },
    meta: {
      title: '登录'
    }
  }

]
export default routes
